#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QDate>
#include <QDebug>

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    // 获取当前日期
    QDate d = QDate::currentDate();
    // 打印日期方式1
    qDebug() << "year:" << d.year() << "month:" << d.month() << "day:" << d.day();
    // 方式2
    QString str = d.toString("yyyy-MM-dd");
    qDebug() << str;
}

MainWindow::~MainWindow()
{
    delete ui;
}
